@extends('layouts.web')

@section('title', $site->name.' - '.$col->title)
@section('keywords', $site->keywords)
@section('description', $site->description)

@section('content')
    <div class="main-container">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md8">
                <div class="layui-card">
                    <div class="layui-card-header none-border">
                        <div class="layui-breadcrumb" style="visibility: visible;">
                            <a href="{{ url('/') }}">首页</a>
                            <span lay-separator="">/</span>
                            <a href="{{ url('/site/'.$parent->id) }}/" target="_blank">{{ $parent->title }}</a>
                            <span lay-separator="">/</span>
                            <a href="{{ url('/site/'.$col->id.'/son/'.$nav_id) }}/" target="_blank">{{ $col->title }}</a>
                            <span lay-separator="">/</span>
                            <a><cite>正文</cite></a>
                        </div>
                    </div>
                </div>
                <div class="layui-card">
                    <div class="layui-card-header site-info-top site-padding">
                        <h2>
                            {{ str_limit($site->name,20,'……') }}
                            <span class="layui-hide-xs">
                                <a class="outNum" blood-sid="2516" href="http://{{ $site->url }}" title="{{ $site->name }}" target="_blank">
                                    {{ $site->url }}
                                </a>
                            </span>
                            <em class="layui-hide-xs">更新：<em class="refresh-time">{{ $site->updated_at }}</em></em>
                        </h2>
                    </div>
                    <div class="layui-card-body site-list-body">
                        <div class="layui-row">
                            <div class="layui-col-md12 site-info-top site-padding">
                                <p>{{ $site->description }}</p>
                            </div>
                            <div class="layui-col-md12">
                                <div class="web-data">
                                    <li>
                                        <span>
                                            <img src="{{ url('img/br-bg.png') }}" alt="百度权重">
                                            <em class="refresh-br">{{ $site->content['br'] }}</em>
                                        </span>
                                        <p>百度权重</p>
                                    </li>
                                    <li>
                                        <span>
                                            <img src="{{ url('img/mbr-bg.png') }}" alt="百度移动权重">
                                            <em class="refresh-mbr">{{ $site->content['mbr'] }}</em>
                                        </span>
                                        <p>移动权重</p>
                                    </li>
                                    <li>
                                        <span>
                                            <img src="{{ url('img/sbr-bg.png') }}" alt="搜狗权重">
                                            <em class="refresh-sbr">{{ $site->content['sbr'] }}</em>
                                        </span>
                                        <p>搜狗PR</p>
                                    </li>
                                    <li>
                                        <span>
                                            <img src="{{ url('img/pr-bg.png') }}" alt="Google权重">
                                            <em class="refresh-pr">{{ $site->content['pr'] }}</em>
                                        </span>
                                        <p>谷歌PR</p>
                                    </li>
                                    <li>
                                        <span class="refresh-alexa">{{ $site->content['alexa'] }}</span>
                                        <p>Alexa排名</p>
                                    </li>
                                    <li>
                                        <span>0</span>
                                        <p>入站记录</p>
                                    </li>
                                    <li>
                                        <span>0</span>
                                        <p>出站记录</p>
                                    </li>
                                    <li>
                                        <span id="views">{{ $site->views }}</span>
                                        <p>热度</p>
                                    </li>
                                </div>
                            </div>
                            <div class="layui-col-md9">
                                <ul class="site-info-list">
                                    <li>网站地址：
                                        <a class="outNum" blood-sid="2516" href="http://{{ $site->url }}" title="{{ $site->name }}" target="_blank" rel="nofollow">
                                            {{ $site->url }}
                                        </a>
                                    </li>
                                    <li>网站评分：
                                        <div class="concern layui-inline" id="Star">
                                            <ul class="layui-rate">
                                                <li class="layui-inline">
                                                    <i class="layui-icon layui-icon-rate-solid" style="color: #FF8000;"></i>
                                                </li>
                                                <li class="layui-inline">
                                                    <i class="layui-icon layui-icon-rate-solid" style="color: #FF8000;"></i>
                                                </li>
                                                <li>
                                                    <i class="layui-icon layui-icon-rate-half" style="color: #FF8000;"></i>
                                                </li>
                                                <li class="layui-inline">
                                                    <i class="layui-icon layui-icon-rate" style="color: #FF8000;"></i>
                                                </li>
                                                <li class="layui-inline">
                                                    <i class="layui-icon layui-icon-rate" style="color: #FF8000;"></i>
                                                </li>
                                            </ul>
                                            <span class="layui-inline">2.5星</span>
                                        </div>
                                    </li>
                                    <li>服务器IP：
                                        <a href="" title="IP：{{ $site->content['ip'] }} 的归属查询结果" target="_blank">
                                            <span class="refresh-ip">
                                                {{ $site->content['ip'] }}
                                            </span>
                                        </a>
                                    </li>
                                    <li>收录时间：{{ $site->created_at->format('Y-m-d') }}</li>
                                    <li>所属分类：
                                        <a href="{{ url('/site/'.$parent->id) }}/" target="_blank">{{ $parent->title }}</a>
                                        &gt;
                                        <a href="{{ url('/site/'.$col->id.'/son/'.$nav_id) }}/" target="_blank">{{ $col->title }}</a>
                                    </li>
                                    <li>更新时间：{{ $site->updated_at->format('Y-m-d') }}</li>
                                    <li>所属地域：
                                        <a href="{{ url('/area/'.$site->area->name) }}/" target="_blank">{{ $site->area->name }}</a>
                                    </li>
                                    <li>网站TAG：
                                        @foreach(explode(",",$site->keywords) as $v)
                                            <a href="{{ url('/tags/'.$v) }}" target="_blank">{{ $v }}</a>
                                        @endforeach
                                    </li>
                                    <li class="ss-link">
                                        搜索引擎：
                                        <a rel="nofollow" href="https://www.baidu.com/s?wd={{ $site->url }}" target="_blank" class="layui-hide-xs">百度搜索</a>
                                        <a rel="nofollow" href="https://www.baidu.com/s?wd=site%3A{{ $site->url }}" target="_blank">百度收录</a>
                                        <a rel="nofollow" href="https://www.so.com/s?ie=utf-8&amp;q={{ $site->url }}" target="_blank" class="layui-hide-xs">360搜索</a>
                                        <a rel="nofollow" href="https://www.so.com/s?ie=utf-8&amp;q=site%3A{{ $site->url }}" target="_blank">360收录</a>
                                        <a rel="nofollow" href="https://www.sogou.com/sogou?query={{ $site->url }}" target="_blank" class="layui-hide-xs">搜狗搜索</a>
                                        <a rel="nofollow" href="https://www.sogou.com/sogou?query=site%3A{{ $site->url }}" target="_blank">搜狗收录</a>
                                    </li>
                                </ul>
                            </div>
                            <div class="layui-col-md3">
                                <div class="site-img-btn">
                                    <div class="site-info-img">
                                        <img class="load" alt="{{ $site->name }}网站缩略图" src="{{ hostStr('files/loading.gif') }}" lay-src="{{ hostStr('shot/'.$site->url.'.jpg') }}">
                                    </div>
                                    <div class="layui-btn-group">
                                        <button class="layui-btn layui-btn-sm show-qrcode layui-hide-xs">二维码</button>
                                        <button class="layui-btn layui-btn-sm layui-btn-danger reported">举报</button>
                                        <a href="{{ url('website/claim') }}" class="layui-btn layui-btn-sm layui-btn-danger">认领</a>
                                    </div>
                                    <div class="layui-btn-group">
                                        <button class="layui-btn layui-btn-sm refresh-seo">更新SEO</button>
                                        <button class="layui-btn layui-btn-sm refresh-icp">更新ICP</button>
                                        <button class="layui-btn layui-btn-sm refresh-snapshot">更新快照</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body prev-next">
                        @if($prev)
                            <div class="prev">
                                上一站点：
                                <a href="{{ url('/siteinfo-'.$prev->id.'.html') }}" class="prev-next-a" title="{{ $prev->name }}">
                                    {{ $prev->name }}
                                </a>
                            </div>
                        @else
                            <div class="prev">
                                上一站点：
                                没有了更多站点了……
                            </div>
                        @endif
                        @if($next)
                            <div class="next">
                                下一站点：
                                <a href="{{ url('/siteinfo-'.$next->id.'.html') }}" class="prev-next-a" title="{{ $next->name }}">
                                    {{ $next->name }}
                                </a>
                            </div>
                        @else
                            <div class="next">
                                下一站点：
                                没有了更多站点了……
                            </div>
                        @endif
                    </div>
                </div>
            </div>
            <div class="layui-col-md4">
                @include('layouts.right')
            </div>
            @if($site->icp)
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body site-list-body site-info-new article-side-site">
                            <ul class="icp-beian">
                                <li>
                                    <em>单位名称：</em>
                                    <a href="#" title="{{ $site->icp->name }}">
                                        {{ $site->icp->name }}
                                    </a>
                                </li>
                                <li>
                                    <em>单位性质：</em>
                                    {{ $site->icp->type }}
                                </li>
                                <li>
                                    <em>备案号：</em>
                                    {{ $site->icp->now_icp }}
                                </li>
                                <li>
                                    <em>审核时间：</em>
                                    {{ $site->icp->check_date }}
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            @endif
            @if(isset($site_list))
                <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">相关网站</div>
                    <div class="layui-card-body related">
                        <div class="layui-row layui-col-space15">
                                @foreach($site_list as $v)
                                    <div class="layui-col-md2 layui-col-xs6">
                                        <div class="site clearfix">
                                            <div class="siteImg">
                                                <a href="{{ url('/siteinfo-'.$v->id.'.html') }}" title="{{ $v->name }}">
                                                    <img class="load" alt="{{ $v->name }}" src="{{ hostStr('files/loading.gif') }}" lay-src="{{ hostStr('shot/'.$v->url.'.jpg') }}">
                                                </a>
                                            </div>
                                            <h3 class="title">
                                                <a href="{{ url('/siteinfo-'.$v->id.'.html') }}" title="{{ $v->name }}">{{ $v->name }}</a>
                                                <span>{{ $v->url }}</span>
                                            </h3>
                                        </div>
                                    </div>
                                @endforeach
                        </div>
                    </div>
                </div>
            </div>
            @endif
        </div>
    </div>
@endsection

@section('scriptsAfterJs')
    <script>
        layui.use(['layer', 'rate','jquery'], function(){
            var layer = layui.layer ,$ = layui.jquery,rate = layui.rate;
            //渲染
            var ins1 = rate.render({
                elem: '#Star'  //绑定元素
            });
            $(".refresh-icp").on("click", function(){
                $.ajax({
                    type: "GET",
                    url: "{{ url('icp/'.$site->id) }}",
                    dataType: "json",
                    cache: false,
                    beforeSend: function () {
                        layer.load();
                    },
                    success: function(str){
                        layer.closeAll();
                        layer.msg(str.msg);
                        if(str.code == 0) {
                            setTimeout(function(){
                                window.location.reload();//刷新当前页面.
                            },3000)
                        }
                    },
                    error: function (str) {
                        layer.closeAll();
                        layer.msg('请您稍后从新操作……');
                    }
                });
            });
            $(".refresh-seo").on("click", function(){
                $.ajax({
                    type: "GET",
                    url: "{{ url('seo/'.$site->id) }}",
                    dataType: "json",
                    cache: false,
                    beforeSend: function () {
                        layer.load();
                    },
                    success: function(str){
                        layer.closeAll();
                        layer.msg(str.msg);
                        if(str.code == 0) {
                            setTimeout(function(){
                                window.location.reload();//刷新当前页面.
                            },3000)
                        }
                    },
                    error: function (str) {
                        layer.closeAll();
                        layer.msg('请您稍后从新操作……');
                    }
                });
            });
            $(".refresh-snapshot").on("click", function(){
                $.ajax({
                    type: "get",
                    url: "{{ url('snapshot/'.$site->id) }}",
                    dataType: "json",
                    cache: false,
                    beforeSend: function () {
                        layer.load();
                    },
                    success: function(str){
                        layer.closeAll();
                        layer.msg(str.msg);
                        if(str.code == 0) {
                            setTimeout(function(){
                                window.location.reload();//刷新当前页面.
                            },3000)
                        }
                    },
                    error: function (str) {
                        layer.closeAll();
                        layer.msg('请您稍后从新操作……');
                    }
                });
            });
        });
    </script>
@endsection